/*
CBA
414243
*/

#include <iostream>
#include <cstdlib>
using namespace std;
int main(void){
	int a = 100;
	double a1 = (double)a; //c风格
	double a2 = double(a);//C++风格

	double b = static_cast<double>(a);
	
	void *p = malloc(100);
	int *pi = static_cast<int *>(p);
	char *pc = static_cast<char *>(p);
	//int num = static_cast<int>(p); //error
	//pi = static_cast<int *>(pc); //error
	
	long num = reinterpret_cast<long>(p);
	pi = reinterpret_cast<int *>(pc);
	
	int n = 0x00414243;
	//16进制的41 对应的是十进制65,故对应的字母是A
	//这里是小端对齐，所以char *拿到的地址是存储43的地址
	char *ps = reinterpret_cast<char *>(&n);
	//故打印出 CBA
	cout << ps << endl;
	//414243
	cout << hex << n << endl ;
	return 0;
}
